<route>
{
    meta: {
        layout: false,
        title:'登录'
    }
}  
</route>
<template>
  <view>
    <QrLoginTemplate title="毕设管理系统" :loading="loading" :enableCaptcha="true" @login="doLogin" />
  </view>
</template>

<script setup name="Login">
import {indexPath} from '../../../../../env/config'
import RyLoginTemplate from "./components/RyLoginTemplate.vue";
import QrLoginTemplate from "./components/QrLoginTemplate.vue";
import { getCodeImg, getQrCode, checkQrCode } from "@/api/auth";
import useApp from "@/hooks";
const { $ } = useApp();
// pinia
import useUserStore from "@/store/modules/user";
const userStore = useUserStore();
const loading = ref(false);
// 点击登录
function doLogin(e) {
  loading.value = true;
  console.log(e);
  userStore
    .doLogin(e)
    .then((res) => {
      loading.value = false;
      console.log(res);
      $.navigateTo({
        url:indexPath
      });
    })
    .catch((e) => {
      loading.value = false;
    });
}
// 获取验证码
provide("getCodeImg", getCodeImg);
</script>
